const person = {
    name: "罗俊华"
}

const handler = {
    get(target, key, context) {
        console.log("代理拦截到正在访问", key)
        return Reflect.get(target, key, context)
    },
    set(target, key, context) {
        console.log("代理拦截到设置属性",key,context)
        // 如果代理不把请求转发给 被代理对象的话，那么这个属性就不会被修改
        Reflect.set(target,key,context)
    }
}

const personProxy = new Proxy(person, handler)

console.log(personProxy.name)

personProxy.name = "高仔"

console.log(personProxy.name)
